package com.xuhuan.server.business.splitfile.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuhuan.server.business.splitfile.entity.FileSplitReceive;
import com.xuhuan.server.business.splitfile.mapper.FileSplitReceiveMapper;
import com.xuhuan.server.business.splitfile.service.IFileSplitReceiveService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author huan.xu
 * @Date 2023/6/19 13:34
 * @Description
 */
@Service
public class FileSplitReceiveServiceImpl extends
        ServiceImpl<FileSplitReceiveMapper, FileSplitReceive> implements IFileSplitReceiveService {
    /**
     * 根据文件唯一标识查询分片信息
     *
     * @param fileMd5
     * @return
     */
    @Override
    public List<FileSplitReceive> findByFileMd5(String fileMd5) {
        LambdaQueryWrapper<FileSplitReceive> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(FileSplitReceive::getFileMd5, fileMd5);
        return baseMapper.selectList(queryWrapper);
    }
}
